Skip to content

[Attention][MLA] Guard NoPE-512 SM90 selection; fix FA3 sparse zero-rope MQA - #22

Open
Leoyzen wants to merge 2 commits into
JaredforReal:wire_sm90_kernelsfrom
Leoyzen:pr1-sm90-wire
Open

Leoyzen wants to merge 2 commits into
JaredforReal:wire_sm90_kernelsfrom
Leoyzen:pr1-sm90-wire

Conversation

@Leoyzen

@Leoyzen Leoyzen commented Sep 14, 2026

Copy link
Copy Markdown

Two follow-ups on this branch, kept as a separate commit so they can be reviewed independently.

The head_size == 512 case in supports_combination now has a real guard. Adding 512 to get_supported_head_sizes() unconditionally reorders the SM100 list: with more than 16 heads (TP<=2) the default flips from FLASHINFER_MLA_SPARSE to FLASHMLA_SPARSE, and that path has no NoPE-512 entry. The bf16 arm is therefore limited to SM90, which leaves the SM100 order untouched. Plain fp8, SM100 bf16 and a rope-carrying 512 model are rejected; the quantized DS-MLA formats are rejected here too and handled separately in vllm-project#55543.

Second, the zero-rope fix from vllm-project#56665 is ported into flashattn_mla_sparse.py. vllm-project#56665 was closed pointing at vllm-project#55385, but this branch never touched that file, so forward_mqa still hands FA3 an empty head-dim tensor for rope-free models.

Added tests/v1/attention/test_flashmla_nope_sm90_backend_selection.py (CPU-only): the selection matrix plus a guard that the SM100 bf16 order is unchanged.

pytest tests/v1/attention/test_flashmla_nope_sm90_backend_selection.py -> 28 passed, 3 skipped (GPU-only).

The bf16-512 FlashMLA decode path has not been run on hardware here; it needs an SM90 smoke before this is relied on.

JaredforReal and others added 2 commits September 13, 2026 06:23
- FlashMLA sparse: admit head_size 512 (bf16 only) and skip the
  concat_mla_q call when the rope part is empty
- MLA prefill: whitelist the GLM5Next NoPE dims (256, 0, 256)
- cmake: pin vllm-flash-attn and FlashMLA to the NoPE support commits

Signed-off-by: JaredforReal <w13431838023@gmail.com>
Co-authored-by: Kimi Code <noreply@moonshot.cn>
… MQA

GLM5Next is rope-free MLA (qk_nope_head_dim=256, qk_rope_head_dim=0,
v_head_dim=256, kv_lora_rank=512), so head_size is 512. Two fixes:

- Replace the unconditional head_size==512 rejection with a merged
  predicate that admits a rope-free bf16/auto cache on SM90, and rejects
  everything else (plain fp8, SM100 bf16, rope-carrying 512, and the
  quantized DS-MLA formats, which are served by the zero-padded 576/656B
  envelope wired up separately). Restricting the bf16 arm to SM90 keeps
  the SM100 priority order unchanged (FlashInfer stays the default for
  >16 heads).
- Port the FlashAttention sparse zero-rope fix: when qk_rope_head_dim
  is 0, feed FA3 a zero 64-wide q_rope and slice k_cache from v_cache,
  instead of handing it an empty head-dim tensor.

Add CPU tests pinning the selection contract and the SM100 order.

Signed-off-by: Leoyzen <leoyzen@gmail.com>
@JaredforReal

Copy link
Copy Markdown
Owner

@Leoyzen hey thanks for your great contributions
I'm gonna merge your PR into my dev branch, can u resolve the conflicts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants